<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>历史管理</title>
</head>
<body>
    <!-- 触发历史改变：
        1、通过跳转页面
        2、hash
        3、pushState -->

        <input id="input" type="button" value="按钮" />
        <div id="div1">

        </div>

        <script>
            var oInput = document.getElementById("input");

            var oDiv = document.getElementById("div1");


            oInput.onclick = function () {

                var json = {};

                var num = Math.random();

                var arr = sevenNum(35, 7);

                json[num] = arr;

                window.location.hash = num

                // oDiv.innerHTML = sevenNum(35, 7);

                console.log(window.location)
            }

            function sevenNum(isAll, isNow) {
                var isAllArr = [];
                var isNowArr = [];
                var isNewNowArr = []

                for(var i = 1; i <= isAll; i++) {
                    isAllArr.push(i)
                }

                for(var i = 0; i < isNow; i++) {
                    isNowArr.push( isAllArr.splice( Math.floor( Math.random()*isAllArr.length ), 1) )
                }
                return isNowArr
            }
        </script>
</body>
</html>